import React, { Component } from 'react';
import {
	StyleSheet, View
} from "react-native";
import { GLOBAL } from '../../../../config/global';
import { style } from '../../../../theme/style';
import navigationSeevice from '../../../../components/navigation/navigationSeevice';
import { BaseItem } from './BaseItem';

const scale = GLOBAL.SCALE;
export class ModifyBaseInfo extends Component {
	constructor(props) {
		super(props);
	}

	render() {
		const { data, choice, approveType } = this.props;
		let { changeId, corpName, bizMode, orderId, statusName, orderStatus, companyName, oppoOrderid, oppoOrderStatus,
			oppocompanyName, bizStaffName, organName, bizTeamName, finalContractFileId, finalContractFileName, longType, status, orderType, attachmentId } = data || {};
		if (approveType == "ZXYC") {
			finalContractFileId = attachmentId;
			oppoOrderid = data.oppoOrderId; //中新油字段差异
		}
		console.log('基本信息', data)
		return (
			<View>
				<BaseItem label={'变更编号'} afterValueDesc={changeId || ''} />
				{approveType == "A" || approveType == "LC" ? <BaseItem label={'业务组织'} afterValueDesc={corpName || ''} /> : null}
				{approveType == "A" || approveType == "ZXYC" ? <BaseItem label={'闭口订单'} afterValueDesc={bizMode ? '是' : '否'} /> : null}
				{approveType == "LC" ? <BaseItem label={'是否长约框架'} afterValueDesc={'是'} /> : null}
				{approveType == "LC" ? <BaseItem label={'长约框架类型'} afterValueDesc={longType == 0 ? '框架' : '长约'} /> : null}

				<BaseItem
					label={`申请变更${approveType == "ZXYC" ? "单号" : "订单"}`}
					afterValueDesc={`${orderId}（${approveType == "ZXYC" ? statusName : orderStatus}）`}
					valueStyle={{ color: style.color.themeColor }}
					afterValueOnPress={() => {
						if (approveType == "ZXYC") {
							navigationSeevice.navigate('SinoNewOrderDetailPage', {
								paramsData: { orderId, orderType, bizMode, statusName, status },
								choice
							})
						} else {
							navigationSeevice.navigate('OrderDetailsPage', {
								orderId,
								choice
							})
						}
					}} />
				<BaseItem label={`申请变更${approveType == "ZXYC" ? "单号" : "订单"}`} afterValueDesc={companyName} valueStyle={{ color: '#999' }} labelStyle={{ opacity: 0 }} />

				{oppoOrderid && approveType != "LC" ? <BaseItem label={`关联变更${approveType == "ZXYC" ? "单号" : "订单"}`}
					afterValueDesc={`${oppoOrderid}（${approveType == "ZXYC" ? statusName : oppoOrderStatus}）`}
					valueStyle={{ color: style.color.themeColor }}
					afterValueOnPress={() => {
						if (approveType == "ZXYC") {
							navigationSeevice.navigate('SinoNewOrderDetailPage', {
								paramsData: { orderId: oppoOrderid, orderType, bizMode, statusName, status },
								choice
							})
						} else {
							navigationSeevice.navigate('OrderDetailsPage', {
								orderId: oppoOrderid,
								choice
							})
						}
					}} /> : null}
				{oppoOrderid ? <BaseItem label={''} afterValueDesc={oppocompanyName} valueStyle={{ color: '#999' }} /> : null}

				<BaseItem label={'业务员/部门'}
					afterValueDesc={(bizStaffName || bizTeamName || organName) ? `${bizStaffName || '--'} | ${bizTeamName || '--'} | ${organName || '--'}` : '--'} />
				{
					finalContractFileId ? <BaseItem label={approveType == "ZXYC"?'变更附件':'合同附件'} valueStyle={{ color: style.color.themeColor }} afterValueDesc={finalContractFileName || '查看合同'}
						afterValueOnPress={() => navigationSeevice.navigate('ContractPdfPage', {
							finalFileId: finalContractFileId, title: finalContractFileName
						})} /> : null
				}
			</View>
		)
	}
}

const styles = StyleSheet.create({


})